import req from '@/request.js'
import utils from '@/hotent-ui-util.js'
import {Promise} from 'q'

const baseUrl = window.context.baseUrl
const mockUserInfo = {
  "role": {
    "roleName": ""
  },
  "post": {
    "1749677019567808512": {
      "pathName": "行政维度/系统默认组织",
      "postJobId": "1258608888039739392",
      "jobName": "职员",
      "orgName": "系统默认组织",
      "showStatus": "1",
      "postId": "1749677019567808512",
      "orgId": "1665958148273422336",
      "jobId": "1258608888039739392",
      "orgShowStatus": "1",
      "orgCode": "gsmc",
      "isMaster": 1,
      "postName": "默认岗位",
      "demId": "1258608622670319616",
      "isCharge": 0,
      "postCode": "gsmc_zy_mrgw",
      "demName": "行政维度"
    }
  },
  "org": [
    {
      "pathName": "行政维度/系统默认组织",
      "postJobId": "1258608888039739392",
      "jobName": "职员",
      "orgName": "系统默认组织",
      "showStatus": "1",
      "postId": "1749677019567808512",
      "orgId": "1665958148273422336",
      "parentId": null,
      "jobId": "1258608888039739392",
      "orgShowStatus": "1",
      "orgCode": "gsmc",
      "isMaster": 1,
      "postName": "默认岗位",
      "demId": "1258608622670319616",
      "isCharge": 0,
      "postCode": "gsmc_zy_mrgw",
      "demName": "行政维度",
      "name": "系统默认组织"
    }
  ],
  "roles": [],
  "allOrgMap": [
    {
      "pathName": "行政维度/测试组织",
      "jobName": "员工",
      "orgName": "测试组织",
      "orgId": "1749672943534792704",
      "jobId": "1749678490275340292",
      "orgShowStatus": "1",
      "orgCode": "cszz",
      "isMaster": 0,
      "demId": "1258608622670319616",
      "demName": "行政维度"
    },
    {
      "pathName": "行政维度/系统默认组织",
      "postJobId": "1258608888039739392",
      "jobName": "职员",
      "orgName": "系统默认组织",
      "showStatus": "1",
      "postId": "1749677019567808512",
      "orgId": "1665958148273422336",
      "jobId": "1258608888039739392",
      "orgShowStatus": "1",
      "orgCode": "gsmc",
      "isMaster": 1,
      "postName": "默认岗位",
      "demId": "1258608622670319616",
      "isCharge": 0,
      "postCode": "gsmc_zy_mrgw",
      "demName": "行政维度"
    }
  ],
  "curPost": "系统默认组织 - 默认岗位",
  "job": [
    {
      "name": "组织职务",
      "id": "1749685208774402048"
    },
    {
      "name": "职员",
      "id": "1258608888039739392"
    },
    {
      "name": "员工",
      "id": "1749678490275340292"
    },
    {
      "name": "abc",
      "id": "1749690100565991424"
    }
  ],
  "user": {
    "isDelete": "0",
    "version": 37,
    "id": "1",
    "fullname": "超级管理员",
    "account": "admin",
    "email": "",
    "mobile": "",
    "address": "",
    "photo": "",
    "sex": "",
    "from": "system",
    "status": 1,
    "groupId": "",
    "hasSyncToWx": 1,
    "userNumber": "1",
    "idCard": "",
    "phone": "",
    "education": "",
    "tenantId": "-1",
    "twoVerifySecret": "A7ZNIXKUS6RPSA42",
    "showStatus": "1",
    "tenantCode": "platform",
    "attributes": {},
    "enabled": true,
    "username": "admin",
    "admin": true,
    "enable": true,
    "userId": "1",
    "identityType": "user",
    "accountNonExpired": true,
    "credentialsNonExpired": true,
    "accountNonLocked": true,
    "pkVal": "1"
  }
};
export default {
  getUserByAccount(account, cb) {
    cb(mockUserInfo);
  },
  // 双因素校验（登录页）
  twoStepVerify(data) {
    const url = `${baseUrl}/api/twoVerify/v1/twoStepVerify`
    return req.post(url, data)
  },
  //双因素校验并绑定（登录页强制绑定）
  twoStepVerifyAndBind(data) {
    const url = `${baseUrl}/api/twoVerify/v1/twoStepVerifyAndBind`
    return req.post(url, data)
  }
}
